# Contributor: Bart Ribbers <bribbers@disroot.org>
# Maintainer: Bart Ribbers <bribbers@disroot.org>

# The group tag is just to easily find this APKBUILD by some scripts for automation
# group=kde-other
pkgname=ruqola
pkgver=2.1.1
pkgrel=0
pkgdesc="A Qt client for Rocket Chat"
url="https://invent.kde.org/network/ruqola"
# armhf blocked by qt5-qtdeclarative-dev
# ppc64le, riscv64 and s390x blocked by qt6-qtwebengine -> purpose
arch="all !armhf !ppc64le !riscv64 !s390x"
license="GPL-2.0-only OR GPL-3.0-only"
makedepends="
	extra-cmake-modules
	kconfig-dev
	kcoreaddons-dev
	kcrash-dev
	kdbusaddons-dev
	kdoctools-dev
	ki18n-dev
	kidletime-dev
	kio-dev
	knotifications-dev
	knotifyconfig-dev
	kstatusnotifieritem-dev
	ktextaddons-dev
	ktextwidgets-dev
	kuserfeedback-dev
	kxmlgui-dev
	libsecret-dev
	prison-dev
	purpose-dev
	qt6-qtbase-dev
	qtkeychain-dev
	qt6-qtmultimedia-dev
	qt6-qtnetworkauth-dev
	qt6-qtwebsockets-dev
	samurai
	sonnet-dev
	syntax-highlighting-dev
	"
checkdepends="xvfb-run"
_repo_url="https://invent.kde.org/network/ruqola.git"
source="https://download.kde.org/stable/ruqola/ruqola-$pkgver.tar.xz"

build() {
	cmake -B build -G Ninja \
		-DBUILD_WITH_QT6=ON \
		-DCMAKE_BUILD_TYPE=RelWithDebInfo \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_INSTALL_LIBDIR=lib
	cmake --build build
}

check() {
	# Skip broken tests
	local skipped_tests="("
	local tests="
		roomscleanhistoryjob
		roomsexportjob
		user
		channelcounterinfo
		roomheaderwidget
		messagelinewidget
		messagelistdelegate
		inviteuserswidget
		showvideowidget
		"
	for test in $tests; do
		skipped_tests="$skipped_tests|$test"
	done
	skipped_tests="$skipped_tests)test"
	xvfb-run ctest --test-dir build --output-on-failure -E "$skipped_tests"
}

package() {
	DESTDIR="$pkgdir" cmake --install build
}

sha512sums="
f968c946673fdbbcbc329088daf98b226213e9a9a3c7c8575f77a75e277a5490ac796dfa53aea5f8d8eb4c010f4ce5d1d047116ab15d850388280031d64c937e  ruqola-2.1.1.tar.xz
"
